﻿/*自定义--校区管理*/
import { routerRedux } from 'dva/router';
import * as LoginService from '../services/basics';

export default {
    namespace: 'theme',
    state: {
        data: [],
    },
    effects: {
        //单独课程  校长查询  admin新增 的单独课程
        *fetch_course2({ payload,callback}, { call, put }) {
            const response = yield call(LoginService.get,'/api/web/system/getSchoolCourse',payload); 
            callback(response.data.res,response.data.obj);
        },

        *fetch_course({ payload,callback }, { call, put }) {
            const response = yield call(LoginService.get,'/api/web/system/getThemeCourse',payload); 
            callback(response.data.res,response.data.obj);
        },

        *add_Themecourse({ payload, callback }, { call, put }) {
            const response = yield call(LoginService.post,'/api/web/system/insertThemeCourse', payload);
            callback(response.data.res,response.data.resMsg);
        },
        *remove_themeCouse({ payload, callback }, { call, put }) {
            const response = yield call(LoginService.post,'/api/web/system/deleteThemeCourse', payload);
            callback(response.data.res,response.data.resMsg);
        },
		//新
		//默认进来table1
		*fetch_cou({ payload,callback}, { call, put }) {
            const response = yield call(LoginService.get,'/api/web/schoolCoursePage/getSchoolCourseSyllabus',payload); 
            callback(response.data.res,response.data.obj);
        },
        //table2数据
		*fetch_cou2({ payload,callback}, { call, put }) {
            const response = yield call(LoginService.get,'/api/web/schoolCoursePage/getSchoolCourseTable',payload); 
            callback(response.data.res,response.data.obj);
        },




    },
    reducers: {
        save(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
    },
};
